package com.homeWork;

public class Teacher {
    private String name;
    private String sex;
    private int age;
    private int teacherAge;
    private String school;

    public Teacher(String name, String sex, int age, int teacherAge, String school) {
        this.name = name;
        this.sex = sex;
        this.age = age;
        this.teacherAge = teacherAge;
        this.school = school;
    }

    public Teacher() {
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
      if (age>0){
          this.age = age;
      }else{
          this.age=30;
      }
    }


    public int getTeacherAge() {
        return teacherAge;
    }

    public void setTeacherAge(int teacherAge) {
        if (teacherAge>0&&teacherAge<this.age){
            this.teacherAge=teacherAge;
        }else{
            this.teacherAge=this.age-20;
        }
    }

    public String getSchool() {
        return school;
    }

    public void setSchool(String school) {
        this.school = school;
    }
    public void showInfo(){
        System.out.println("姓名："+getName()+" 性别"+getSex()+"年龄："+getAge()+" 教龄："+getTeacherAge()+"所在中心："+getSchool());

    }
}
